{if $tourney eq 0}
<p>No se ha creado un torneo a&uacute;n, por lo tanto no se pueden crear partidos</p>
{elseif $delgs eq 0 }
<p>No hay delegaciones, por lo tanto no se puede crear un nuevo partido</p>
{elseif $referees eq 0}
<p>No hay arbitros, por lo tanto no se puede crear un nuevo partido</p>
{elseif $num_refr le 1}
<p>No hay suficientes arbitros, por lo tanto no se puede crear un nuevo partido</p>
{else}
<form id="new">
    <input type="hidden" id="gme_del_id_1" name="gme_del_id_1" value="" />
    <input type="hidden" id="gme_del_id_2" name="gme_del_id_2" value="" />
    <table width="100%">
        <tbody>
        <tr height="13">
            <td width="30%" style="vertical-align:top;">
                <fieldset>
                    <legend>Informaci&oacute;n General</legend>
                    <table width="100%">
                        <tbody>
                        <tr>
                            <td width="30%">Lugar:</td>
                            <td>
                                <select id="gme_plc_id" name="gme_plc_id" onfocus="switchColor('gme_plc_id',&#034;#999999&#034;);">
                                    <option value="">--Selecciona--</option>
                                    {foreach item=pool from=$places}
                                    <option value="{$pool.plc_id}">{$pool.plc_name}</option>
                                    {/foreach}
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>Fecha:</td>
                            <td>
                                <input id="gme_date" name="gme_date" type="text" size="20" readonly="readonly" />
                                <img src="images/calendar_view_week.png" onclick="switchColor('gme_date',&#034;#999999&#034;);displayCalendar($('gme_date'),'yyyy.mm.dd',this)" />
                            </td>
                        </tr>
                        <tr>
                            <td>Hora:</td>
                            <td>
                                <select id="hour" onfocus="switchColor('hour',&#034;#999999&#034;);">
                                    <option value="">-</option>
                                    {section name=hour start=8 loop=18 step=1}
                                        <option value="{if $smarty.section.hour.index < 10}0{/if}{$smarty.section.hour.index}">
                                            {if $smarty.section.hour.index < 10}0{/if}{$smarty.section.hour.index}
                                        </option>
                                    {/section}
                                </select>
                                :
                                <select id="min" onfocus="switchColor('min',&#034;#999999&#034;);">
                                    <option value="">-</option>
                                    {section name=min start=0 loop=60 step=10}
                                        <option value="{if $smarty.section.min.index < 10}0{/if}{$smarty.section.min.index}">
                                            {if $smarty.section.min.index < 10}0{/if}{$smarty.section.min.index}
                                        </option>
                                    {/section}
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>Ronda:</td>
                            <td>
                                <select id="gme_rnd_id" name="gme_rnd_id" onfocus="switchColor('gme_rnd_id',&#034;#999999&#034;);">
                                    <option value="">--Selecciona--</option>
                                    {foreach item=round from=$rounds}
                                    <option value="{$round.rnd_id}">{$round.rnd_name}</option>
                                    {/foreach}
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>Categor&iacute;a:</td>
                            <td>
                                <input type="radio" name="gme_gender" value="m">Masculino
                                &nbsp;
                                <input type="radio" name="gme_gender" value="f">Femenino
                            </td>
                        </tr>
                        <tr>
                            <td>Arbitro 1:</td>
                            <td>
                                <select id="gme_referee_1" name="gme_referee_1" onfocus="switchColor('gme_referee_1',&#034;#999999&#034;);">
                                    <option value="">--Selecciona--</option>
                                    {foreach item=ref from=$referees}
                                        <option value="{$ref.usu_id}">{$ref.name}</option>
                                    {/foreach}
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>Arbitro 2:</td>
                            <td>
                                <select id="gme_referee_2" name="gme_referee_2" onfocus="switchColor('gme_referee_2',&#034;#999999&#034;);">
                                    <option value="">--Selecciona--</option>
                                    {foreach item=ref from=$referees}
                                        <option value="{$ref.usu_id}">{$ref.name}</option>
                                    {/foreach}
                                </select>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </fieldset>
            </td>
            <td align="center" style="vertical-align:top;">
                <fieldset>
                    <legend>Equipos</legend>
                    <div id="teams">
                        <div id="scroll">
                            {include file="Game/game_del_pg.tpl"}
                        </div>
                    </div>
                    <br />
                    <table width="100%">
                        <tbody>
                        <tr>
                            <td width="48%" align="center">
                                <div id="team_1" class="droppable">
                                    <div id="item_1">
                                        Equipo 1
                                    </div>
                                </div>
                                {literal}
                                <script type="text/javascript">
                                    Droppables.add('team_1',{accept: 'drag_white', hoverclass:'droppable_hover', onDrop: function(element){new Ajax.Updater('item_1', 'Game/WP_Game.php?action=7', {evalScripts:true, parameters:'del='+encodeURIComponent(element.id),onLoading:function(){$('item_1').innerHTML='<img border="0" src="images/spinner.gif" />'}});}});
                                </script>
                                {/literal}
                            </td>
                            <td width="4%" class="versus">
                                vs
                            </td>
                            <td width="48%" align="center">
                                <div id="team_2" class="droppable">
                                    <div id="item_2">
                                        Equipo 2
                                    </div>
                                </div>
                                {literal}
                                <script type="text/javascript">
                                    Droppables.add('team_2',{accept: 'drag_blue', hoverclass:'droppable_hover', onDrop: function(element){new Ajax.Updater('item_2', 'Game/WP_Game.php?action=7', {evalScripts:true, parameters:'del='+encodeURIComponent(element.id),onLoading:function(){$('item_2').innerHTML='<img border="0" src="images/spinner.gif" />'}});}});
                                </script>
                                {/literal}
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </fieldset>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <input class="button" type="button" value="Crear" onclick="if(validate_game()) sendGame('new','content_area','Game/WP_Game.php?action=9');" />
                <input class="button" type="reset" value="Limpiar" onclick="flush('item_1','item_2','gme_del_id_1','gme_del_id_2');" />
            </td>
        </tr>
        </tbody>
    </table>
</form>
{/if}